<%--
  Created by IntelliJ IDEA.
  User: Xiaoqz
  Date: 2021/8/31
  Time: 10:12
  To change this template use File | Settings | File Templates.
--%>
<%--isELIgnored: ignored EL(Expression Language)--%>
<%--@ page contentType="text/html;charset=UTF-8" language="java" --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--引入JSTL标签库--%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>${user.username}，欢迎您！</h2>
<hr>
<table border="1" cellspacing="0" width="80%">
    <tr>
        <th>序号</th>
        <th>品牌名称</th>
        <th>企业名称</th>
        <th>排序</th>
        <th>品牌介绍</th>
        <th>状态</th>
        <th>操作</th>
    </tr>

    <c:forEach items="${brands}" var="brand" varStatus="status">
        <tr align="center">
                <%--<td>${brand.id}</td>--%>
                <%--<td>${status.index}</td>--%>
            <td>${status.count}</td>
            <td>${brand.brandName}</td>
            <td>${brand.companyName}</td>
            <td>${brand.ordered}</td>
            <td>${brand.description}</td>
            <c:if test="${brand.status == 1}">
                <td>启用</td>
            </c:if>
            <c:if test="${brand.status != 1}">
                <td>禁用</td>
            </c:if>
            <td>
                    <%--<a href="/jsp-brandCRUD/selectByIdServlet?id=${brand.id}">修改</a>--%>
                    <%--<a href="/jsp-brandCRUD/deleteServlet?id=${brand.id}">删除</a>--%>
                <a href="/cookiesession_case/selectByIdServlet?id=${brand.id}">
                    <input type="button" value="修改">
                </a>
                <%--<a href="/jsp-brandCRUD/deleteServlet?id=${brand.id}">
                    <input type="button" value="删除" onclick=deleteBrand()>
                </a>--%>
                <input type="button" value="删除" onclick="new function (){
                    if (confirm('是否确认删除？')) {
                        location.href = '/cookiesession_case/deleteServlet?id=${brand.id}'
                        alert('删除成功！');
                    }
                }" >
            </td>
        </tr>
    </c:forEach>
</table>
<hr>
<%--添加按钮--%>
<input type="button" value="添加" id="add">
<script>
    /*给添加按钮绑定点击事件*/
    document.getElementById("add").onclick = function () {
        /*跳转到添加页面*/
        location.href = "addBrand.jsp";
    };
</script>
</body>
</html>
